package cn.doitedu.api;

import org.apache.flink.runtime.state.*;
import org.apache.flink.streaming.api.operators.AbstractStreamOperator;
import org.apache.flink.streaming.api.operators.OneInputStreamOperator;
import org.apache.flink.streaming.api.operators.StreamOperatorStateHandler;
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;

import java.io.InputStream;
import java.io.ObjectOutputStream;

public class MyOperator extends AbstractStreamOperator<String> implements OneInputStreamOperator<String,String> {

    @Override
    public void initializeState(StateInitializationContext context) throws Exception {

        super.initializeState(context);
        Iterable<StatePartitionStreamProvider> rawOperatorStateInputs = context.getRawOperatorStateInputs();

        for (StatePartitionStreamProvider rawOperatorStateInput : rawOperatorStateInputs) {
            InputStream stream = rawOperatorStateInput.getStream();


        }
    }

    @Override
    public void processElement(StreamRecord<String> element) throws Exception {

    }

    @Override
    public void snapshotState(StateSnapshotContext context) throws Exception {
        OperatorStateCheckpointOutputStream out = context.getRawOperatorStateOutput();
    }
}
